- Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathStackClient.java
35 lines (26 loc) Β· 705 Bytes
/
StackClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
packagesection10_Stacks;
publicclassStackClient {
publicstaticvoidmain(String[] args) throwsException {
intcapacity = 5;
StackUsingArraystack = newStackUsingArray(capacity);
System.out.println(stack.isEmpty());
stack.push(10);
stack.push(20);
stack.push(30);
stack.display();
System.out.println(stack.peek());
System.out.println(stack.size());
System.out.println(stack.isEmpty());
System.out.println(stack.isFull());
System.out.println();
stack.push(40);
stack.display();
System.out.println();
System.out.println(stack.pop());
System.out.println();
stack.display();
System.out.println(stack.pop());
System.out.println();
stack.display();
}
}